import { TaskTargetInfo } from "../../../model/TaskTargetInfo";
import { Alert } from "../../../../../com/mui/controls/Alert";
import { AIManager } from "../../../scene/ai/AIManager";
import { AIType } from "../../../scene/ai/AIType";
import { Dispatcher } from "../../../../mvc/core/Dispatcher";
import { DataEvent } from "../../../events/DataEvent";
import { EventName } from "../../../mvc/EventName";
import { Language } from "../../../../../extend/language/Language";
import { Cache } from "../../../cache/Cache";
type int = number;
//class RepairAlert
    
    export  class RepairAlert
    {
        

        public static showRepair(arg1: Boolean, arg2: Boolean): void
        {
            var isVIP: Boolean;
            var isBreak: Boolean;
            var htmlText: string;
            var taskTargetInfo: TaskTargetInfo;
            var onClose: Function;

            var loc1;
            htmlText = null;
            taskTargetInfo = null;
            onClose = null;
            isVIP = arg1;
            isBreak = arg2;
            onClose = (arg1: int): void
            {
                if (arg1 != Alert.OK) 
                {
                    if (arg1 == Alert.CANCEL) 
                    {
                        if (!isVIP) 
                        {
                            AIManager.onAIControl(taskTargetInfo, AIType.AI_Convey);
                        }
                    }
                }
                else if (isVIP) 
                {
                    Dispatcher.dispatchEvent(new DataEvent(EventName.ShopFixAllEquipment));
                }
                else if (taskTargetInfo) 
                {
                    AIManager.onAutoPathAIControl(taskTargetInfo);
                }
                return;
            }
            Alert.buttonWidth = 75;
            Alert.okLabel = isVIP ? Language.getString(43854) : Language.getString(43855);
            Alert.calcelLabel = isVIP ? Language.getString(43856) : Language.getString(43857);
            if (isVIP) 
            {
                if (isBreak) 
                {
                    htmlText = RepairAlert.VIPBreak;
                }
                else 
                {
                    htmlText = RepairAlert.VIPWillBreak;
                }
            }
            else if (isBreak) 
            {
                htmlText = RepairAlert.Break;
            }
            else 
            {
                htmlText = RepairAlert.WillBreak;
            }
            Alert.showCloseBtn = true;
            Alert.show(htmlText, null, Alert.OK | Alert.CANCEL, null, onClose);
            taskTargetInfo = Cache.instance.scene.getNearlyDrugNpcTarget();
            return;
        }

        /* internal */ static /* var */WillBreak: string;

        /* internal */ static /* var */VIPWillBreak: string;

        /* internal */ static /* var */Break: string;

        /* internal */ static /* var */VIPBreak: string;
    }

            RepairAlert.WillBreak = Language.getString(43850);
            RepairAlert.VIPWillBreak = Language.getString(43851);
            RepairAlert.Break = Language.getString(43852);
            RepairAlert.VIPBreak = Language.getString(43853);
        